package cn.itcast.rabbitmq.spring;

import cn.itcast.utils.MailUtil;
import com.alibaba.fastjson.JSON;
import org.springframework.amqp.core.Message;
import org.springframework.amqp.core.MessageListener;

import java.util.List;
import java.util.Map;

public class JiaoHuoMqListener implements MessageListener {
    @Override
    public void onMessage(Message message) {
        try {
            byte[] body = message.getBody();
            String email = JSON.parseObject(body, String.class);
            MailUtil.sendMsg(email, "催收交货", "公司订购的货物快到期了");
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}
